<template>
  <div>
    <h3>child1，它只负责订阅数据 -- {{ age }}</h3>
  </div>
</template>

<script>
export default {
  data() {
    return {
      age: 100,
    };
  },

  mounted() {
    // 订阅
    this.$bus.$on("age", (age) => (this.age += age));
  },
  beforeDestroy() {
    // 注销
    this.$bus.$off("age");
  },
};
</script>

<style lang="scss" scoped>
</style>